/**
 *                            License
 * THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS  
 * CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). 
 * THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW.  
 * ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR  
 * COPYRIGHT LAW IS PROHIBITED.
 * 
 * BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND  
 * AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE  
 * MAY BE CONSIDERED TO BE A CONTRACT,
 * THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED 
 * HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
 * 
 */
package com.lineage.server.model.skill.executor;

import com.lineage.configure.Config;
import com.lineage.server.PacketCreate;
import com.lineage.server.model.L1Character;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.model.Instance.L1SummonInstance;
import com.lineage.server.model.skill.L1SkillExecutor;
import com.lineage.server.packetserver.S_SkillSound;

/**
 * Class <code>ReturnToNature</code> 精灵魔法:释放元素 (30/0/2).
 * 将利用魔法所召唤和迷魅的怪物之中一个怪物释放
 * 
 * @author jrwz
 * @version 2012-7-24下午02:49:32
 * @see com.lineage.server.model.skill.executor
 * @since JDK1.7
 */
public final class ReturnToNature extends L1SkillExecutor {

    /** 动画. */
    private static final int GFX = 2245;

    /**
     * 取得实例.
     * 
     * @return 实例
     */
    public static L1SkillExecutor get() {
        return new ReturnToNature();
    }

    /** 精灵魔法:释放元素 (30/0/2). */
    private ReturnToNature() {
    }

    @Override
    public void execute(final L1Character user, final L1Character cha,
            final L1Character target, final int targetID, final int skillId,
            final int getBuffIconDuration) {
        if (Config.RETURN_TO_NATURE && (cha instanceof L1SummonInstance)) {
            final L1SummonInstance summon = (L1SummonInstance) cha;
            summon.broadcastPacket(new S_SkillSound(summon.getId(), GFX));
            summon.returnToNature();
        } else {
            if (user instanceof L1PcInstance) {
                final L1PcInstance pc = (L1PcInstance) user;
                PacketCreate.get().sendSinglePackets(pc, "没有任何事情发生");
            }
        }
    }

    @Override
    public void stop(final L1Character cha, final int skillId) {
        // TODO Auto-generated method stub
    }
}
